﻿using System;
using System.IO;
using System.Windows.Forms;
using System.Xml.Linq;
using Styx.Common;

namespace TuanHA_Combat_Routine
{
    public partial class THDKForm : Form
    {
        public THDKForm()
        {
            InitializeComponent();
        }

        private void THDKForm_Load(object sender, EventArgs e)
        {
            if (
                File.Exists(Utilities.AssemblyDirectory +
                            @"\Routines\TuanHADKSpecialEdition\TuanHA-DK-Picture.jpg"))
            {
                pictureBox1.ImageLocation = Utilities.AssemblyDirectory +
                                            @"\Routines\TuanHADKSpecialEdition\TuanHA-DK-Picture.jpg";
            }

            if (File.Exists(Utilities.AssemblyDirectory +
                            @"\Routines\TuanHADKSpecialEdition\SpecialThanks.rtf"))
            {
                richTextBox1.LoadFile(Utilities.AssemblyDirectory +
                                      @"\Routines\TuanHADKSpecialEdition\SpecialThanks.rtf");
            }
            AutoAoE.Checked = THSettings.Instance.AutoAoE;
            AntiMagicShell.Checked = THSettings.Instance.AntiMagicShell;
            AntiMagicShellLichborne.Checked = THSettings.Instance.AntiMagicShellLichborne;
            AntiMagicShellHP.Value = THSettings.Instance.AntiMagicShellHP;
            AntiMagicShellDebuff.Checked = THSettings.Instance.AntiMagicShellDebuff;
            AntiMagicShellDebuffNumber.Value = THSettings.Instance.AntiMagicShellDebuffNumber;
            AntiMagicShellCaster.Checked = THSettings.Instance.AntiMagicShellCaster;
            AntiMagicShellCasterNumber.Value = THSettings.Instance.AntiMagicShellCasterNumber;
            AntiMagicShellEnemy.Checked = THSettings.Instance.AntiMagicShellEnemy;
            AntiMagicShellEnemyHP.Value = THSettings.Instance.AntiMagicShellEnemyHP;
            AntiMagicZone.Checked = THSettings.Instance.AntiMagicZone;
            AntiMagicZoneHP.Value = THSettings.Instance.AntiMagicZoneHP;
            AntiMagicZoneDebuff.Checked = THSettings.Instance.AntiMagicZoneDebuff;
            AntiMagicZoneDebuffNumber.Value = THSettings.Instance.AntiMagicZoneDebuffNumber;
            AntiMagicZoneCaster.Checked = THSettings.Instance.AntiMagicZoneCaster;
            AntiMagicZoneCasterNumber.Value = THSettings.Instance.AntiMagicZoneCasterNumber;
            AutoFace.Checked = THSettings.Instance.AutoFace;
            //AutoAttack.Checked = THSettings.Instance.AutoAttack;
            AutoMove.Checked = THSettings.Instance.AutoMove;
            AutoPathofFrost.Checked = THSettings.Instance.AutoPathofFrost;
            AutoPrecence.Checked = THSettings.Instance.AutoPrecence;
            AutoRacial.Checked = THSettings.Instance.AutoRacial;
            AutoRaiseAlly.Checked = THSettings.Instance.AutoRaiseAlly;
            AutoTarget.Checked = THSettings.Instance.AutoTarget;
            AutoTaunt.Checked = THSettings.Instance.AutoTaunt;
            AttackASAP.Checked = THSettings.Instance.AttackASAP;
            AttackOOC.Checked = THSettings.Instance.AttackOOC;
            Backward.SelectedIndex = THSettings.Instance.Backward;
            //BoneShield.Checked = THSettings.Instance.BoneShield;
            //BloodBoil.Checked = THSettings.Instance.BloodBoil; 
            BloodTap.Checked = THSettings.Instance.BloodTap;
            BloodChargeStack.Value = THSettings.Instance.BloodChargeStack;
            AutoBuff.Checked = THSettings.Instance.AutoBuff;
            BloodPresence.Checked = THSettings.Instance.BloodPresence;
            BloodPresenceHP.Value = THSettings.Instance.BloodPresenceHP;
            BurstKey.SelectedIndex = THSettings.Instance.BurstKey;
            BurstHP.Value = THSettings.Instance.BurstHP;
            //Burst.Checked = THSettings.Instance.Burst;
            ChainsofIce.Checked = THSettings.Instance.ChainsofIce;
            ChainsofIceMinDistance.Value = THSettings.Instance.ChainsofIceMinDistance;
            ChainofIceMelee.Checked = THSettings.Instance.ChainofIceMelee;
            ChainofIceMeleeHP.Value = THSettings.Instance.ChainofIceMeleeHP;
            ChargeInterrupt.Checked = THSettings.Instance.ChargeInterrupt;
            ChargeInterruptMS.Value = THSettings.Instance.ChargeInterruptMS;
            ChargeStunEnemy.Checked = THSettings.Instance.ChargeStunEnemy;
            ChargeStunEnemyHP.Value = THSettings.Instance.ChargeStunEnemyHP;
            ChargeStunFriend.Checked = THSettings.Instance.ChargeStunFriend;
            ChargeStunFriendHP.Value = THSettings.Instance.ChargeStunFriendHP;
            ControlUndead.Checked = THSettings.Instance.ControlUndead;
            DancingRuneWeapon.Checked = THSettings.Instance.DancingRuneWeapon;
            DancingRuneWeaponHP.Value = THSettings.Instance.DancingRuneWeaponHP;
            DarkSimulacrumon.Checked = THSettings.Instance.DarkSimulacrumon;
            DarkSimulacrumonCast.Checked = THSettings.Instance.DarkSimulacrumonCast;
            DarkSimulacrumonCooldown.Checked = THSettings.Instance.DarkSimulacrumonCooldown;
            DarkSimulacrumonAuto.Checked = THSettings.Instance.DarkSimulacrumonAuto;
            DeathandDecaySnare.Checked = THSettings.Instance.DeathandDecaySnare;
            DeathCoilHealPet.Checked = THSettings.Instance.DeathCoilHealPet;
            DeathCoilHealPetHP.Value = THSettings.Instance.DeathCoilHealPetHP;
            DeathGrip.Checked = THSettings.Instance.DeathGrip;
            DeathGripMinDistance.Value = THSettings.Instance.DeathGripMinDistance;
            DeathGripInterrupt.Checked = THSettings.Instance.DeathGripInterrupt;
            DeathGripInterruptMs.Value = THSettings.Instance.DeathGripInterruptMs;
            DeathGripMelee.Checked = THSettings.Instance.DeathGripMelee;
            DeathGripMeleeHP.Value = THSettings.Instance.DeathGripMeleeHP;
            DeathsAdvance.Checked = THSettings.Instance.DeathsAdvance;
            DeathStrike.Checked = THSettings.Instance.DeathStrike;
            DeathStrikeHP.Value = THSettings.Instance.DeathStrikeHP;
            DesecratedGround.Checked = THSettings.Instance.DesecratedGround;
            DesecratedGroundDebuffMinDuration.Value = THSettings.Instance.DesecratedGroundDebuffMinDuration;
            EmpowerRuneWeapon.SelectedIndex = THSettings.Instance.EmpowerRuneWeapon;
            EmpowerRuneWeaponPercent.Value = THSettings.Instance.EmpowerRuneWeaponPercent;
            Follow.Checked = THSettings.Instance.Follow;
            FollowDistance.Value = THSettings.Instance.FollowDistance;
            Forward.SelectedIndex = THSettings.Instance.Forward;
            GargoyleFrenzy.SelectedIndex = THSettings.Instance.GargoyleFrenzy;
            GargoyleFrenzyPercent.Value = THSettings.Instance.GargoyleFrenzyPercent;
            GorefiendsGraspInterrupt.Checked = THSettings.Instance.GorefiendsGraspInterrupt;
            GorefiendsGraspInterruptMS.Value = THSettings.Instance.GorefiendsGraspInterruptMS;
            GorefiendsGraspAggro.Checked = THSettings.Instance.GorefiendsGraspAggro;
            GorefiendsGraspAggroMinDist.Value = THSettings.Instance.GorefiendsGraspAggroMinDist;
            GorefiendsGraspKiter.Checked = THSettings.Instance.GorefiendsGraspKiter;
            GorefiendsGraspKiterMinDist.Value = THSettings.Instance.GorefiendsGraspKiterMinDist;
            GorefiendsGraspMelee.Checked = THSettings.Instance.GorefiendsGraspMelee;
            GorefiendsGraspMeleeHP.Value = THSettings.Instance.GorefiendsGraspMeleeHP;
            GorefiendsGraspAoE.Checked = THSettings.Instance.GorefiendsGraspAoE;
            GorefiendsGraspAoENumber.Value = THSettings.Instance.GorefiendsGraspAoENumber;
            GnawInterrupt.Checked = THSettings.Instance.GnawInterrupt;
            GnawInterruptMS.Value = THSettings.Instance.GnawInterruptMS;
            GnawStunEnemy.Checked = THSettings.Instance.GnawStunEnemy;
            GnawStunEnemyHP.Value = THSettings.Instance.GnawStunEnemyHP;
            GnawStunFriend.Checked = THSettings.Instance.GnawStunFriend;
            GnawStunFriendHP.Value = THSettings.Instance.GnawStunFriendHP;
            HealAttackC.Checked = THSettings.Instance.HealAttackC;
            HealAttackCHP.Value = THSettings.Instance.HealAttackCHP;
            HealAttackD.Checked = THSettings.Instance.HealAttackD;
            HealAttackDHP.Value = THSettings.Instance.HealAttackDHP;
            HealAttackS.Checked = THSettings.Instance.HealAttackS;
            HealAttackSHP.Value = THSettings.Instance.HealAttackSHP;
            HealthStone.Checked = THSettings.Instance.HealthStone;
            HealthStoneHP.Value = THSettings.Instance.HealthStoneHP;
            Huddle.Checked = THSettings.Instance.Huddle;
            HuddleHP.Value = THSettings.Instance.HuddleHP;
            InterruptAll.Checked = THSettings.Instance.InterruptAll;
            InterruptTarget.Checked = THSettings.Instance.InterruptTarget;
            InterruptFocus.Checked = THSettings.Instance.InterruptFocus;
            IceboundFortitude.Checked = THSettings.Instance.IceboundFortitude;
            IceboundFortitudeHP.Value = THSettings.Instance.IceboundFortitudeHP;
            IceboundFortitudeStun.Checked = THSettings.Instance.IceboundFortitudeStun;
            IceboundFortitudeStunDuration.Value = THSettings.Instance.IceboundFortitudeStunDuration;
            LeapRange.Checked = THSettings.Instance.LeapRange;
            LeapRangeDist.Value = THSettings.Instance.LeapRangeDist;
            LichborneFear.Checked = THSettings.Instance.LichborneFear;
            LichborneFearDuration.Value = THSettings.Instance.LichborneFearDuration;
            LichborneHeal.Checked = THSettings.Instance.LichborneHeal;
            LichborneHealHP.Value = THSettings.Instance.LichborneHealHP;
            MindFreezeInterrupt.Checked = THSettings.Instance.MindFreezeInterrupt;
            MindFreezeInterruptMs.Value = THSettings.Instance.MindFreezeInterruptMs;
            NecroticStrikeStack.Checked = THSettings.Instance.NecroticStrikeStack;
            NecroticStrikeDeathRuneNumber.Value = THSettings.Instance.NecroticStrikeDeathRuneNumber;
            NecroticStrikeStackBurst.Checked = THSettings.Instance.NecroticStrikeStackBurst;
            PauseKey.SelectedIndex = THSettings.Instance.PauseKey;
            PillarofFrost.SelectedIndex = THSettings.Instance.PillarofFrost;
            PillarofFrostPercent.Value = THSettings.Instance.PillarofFrostPercent;
            PlagueLeech.Checked = THSettings.Instance.PlagueLeech;
            ProfBuff.SelectedIndex = THSettings.Instance.ProfBuff;
            ProfBuffHP.Value = THSettings.Instance.ProfBuffHP;
            RaiseDead.SelectedIndex = THSettings.Instance.RaiseDead;
            RaiseDeadPercent.Value = THSettings.Instance.RaiseDeadPercent;
            RemorselessWinter.Checked = THSettings.Instance.RemorselessWinter;
            RemorselessWinterHP.Value = THSettings.Instance.RemorselessWinterHP;
            RemorselessWinterEnemy.Checked = THSettings.Instance.RemorselessWinterEnemy;
            RemorselessWinterEnemyNumber.Value = THSettings.Instance.RemorselessWinterEnemyNumber;
            RemorselessWinterDeathGrip.Checked = THSettings.Instance.RemorselessWinterDeathGrip;
            RemorselessWinterBurst.Checked = THSettings.Instance.RemorselessWinterBurst;

            RemorselessWinterEnemyLow.Checked = THSettings.Instance.RemorselessWinterEnemyLow;
            RemorselessWinterEnemyLowHP.Value = THSettings.Instance.RemorselessWinterEnemyLowHP;

            RuneTap.Checked = THSettings.Instance.RuneTap;
            RuneTapHP.Value = THSettings.Instance.RuneTapHP;
            SoulReaper.Checked = THSettings.Instance.SoulReaper;
            SoulReaperHP.Value = THSettings.Instance.SoulReaperHP;
            StrafleLeft.SelectedIndex = THSettings.Instance.StrafleLeft;
            StrafleRight.SelectedIndex = THSettings.Instance.StrafleRight;
            StrangulateInterrupt.Checked = THSettings.Instance.StrangulateInterrupt;
            StrangulateInterruptMs.Value = THSettings.Instance.StrangulateInterruptMs;
            StrangulateInterruptTarget.Checked = THSettings.Instance.StrangulateInterruptTarget;
            StrangulateInterruptTargetHP.Value = THSettings.Instance.StrangulateInterruptTargetHP;
            AsphyxiateHelpFriend.Checked = THSettings.Instance.AsphyxiateHelpFriend;
            AsphyxiateHelpFriendHP.Value = THSettings.Instance.AsphyxiateHelpFriendHP;
            StrangulateLow.Checked = THSettings.Instance.StrangulateLow;
            StrangulateLowHP.Value = THSettings.Instance.StrangulateLowHP;
            Trinket1.SelectedIndex = THSettings.Instance.Trinket1;
            Trinket1HP.Value = THSettings.Instance.Trinket1HP;
            Trinket2.SelectedIndex = THSettings.Instance.Trinket2;
            Trinket2HP.Value = THSettings.Instance.Trinket2HP;
            TurnRight.SelectedIndex = THSettings.Instance.TurnRight;
            TurnLeft.SelectedIndex = THSettings.Instance.TurnLeft;
            UnholyBlight.Checked = THSettings.Instance.UnholyBlight;
            UnittoStartAoE.Value = THSettings.Instance.UnittoStartAoE;
            UseFood.Checked = THSettings.Instance.UseFood;
            UseFoodHP.Value = THSettings.Instance.UseFoodHP;
            VampiricBlood.Checked = THSettings.Instance.VampiricBlood;
            VampiricBloodHP.Value = THSettings.Instance.VampiricBloodHP;
        }

        public string LastSavedMode = "";

        private void OK_Click(object sender, EventArgs e)
        {
            //MessageBox.Show("TuanHA Paladin Settings have been saved", "Save");
            THSettings.Instance.LastSavedMode = LastSavedMode;
            THSettings.Instance.LastSavedSpec = Classname.GetCurrentSpec();
            THSettings.Instance.Save();
            Logging.Write("----------------------------------");
            Logging.Write("TuanHA DK Settings have been saved");

            Logging.Write(LogLevel.Diagnostic, "Your Setting for Debug Purpose Only");
            foreach (var var in THSettings.Instance.GetSettings())
            {
                Logging.Write(LogLevel.Diagnostic, var.ToString());
            }

            Close();

            THSettings.Instance.UpdateStatus = true;
        }

        private void Apply_Click(object sender, EventArgs e)
        {
            THSettings.Instance.LastSavedMode = LastSavedMode;
            THSettings.Instance.LastSavedSpec = Classname.GetCurrentSpec();
            THSettings.Instance.Save();
            Logging.Write("TuanHA DK Settings have been saved");
            THSettings.Instance.UpdateStatus = true;
        }


        public void Dungeon_Click(object sender, EventArgs e)
        {
            MessageBox.Show(
                Classname.GetCurrentSpec() + " Death Knight " +
                "Dungeon Mode: Work best with LazyRaider in Dungeon.",
                //\r\n\r\nMake sure ONLY 3 Options Enabled in LazyRaider:\r\n - Run Without a Tank\r\n - Disable Plug-ins\r\n - Frame Lock",
                "Important Note",
                MessageBoxButtons.OK, MessageBoxIcon.Information);
            Logging.Write("----------------------------------");
            Logging.Write("Dungeon Mode On");
            Logging.Write("----------------------------------");

            if (File.Exists(Utilities.AssemblyDirectory +
                            @"\Routines\TuanHADKSpecialEdition\Preset\TuanHA Death Knight Defaut Dungeon.xml"))
            {
                Logging.Write("----------------------------------");
                THSettings.Instance.LoadFromXML(XElement.Load(Utilities.AssemblyDirectory +
                                                              @"\Routines\TuanHADKSpecialEdition\Preset\TuanHA Death Knight Defaut Dungeon.xml"));
                Logging.Write("Load TuanHA Death Knight Defaut Dungeon Settings from a file complete");
                Logging.Write("----------------------------------");
                THDKForm_Load(null, null);
            }
            else
            {
                Logging.Write("----------------------------------");
                Logging.Write("File not exists: " + Utilities.AssemblyDirectory +
                              @"\Routines\TuanHADKSpecialEdition\Preset\TuanHA Death Knight Defaut Dungeon.xml");
                Logging.Write("Load TuanHA Death Knight Defaut AFK Dungeon from a file fail.");
                Logging.Write("----------------------------------");
            }
        }


        private void Raid_Click(object sender, EventArgs e)
        {
            MessageBox.Show(
                Classname.GetCurrentSpec() + " Death Knight " +
                "Raid Mode: Work best with LazyRaider in Raid.",
                //\r\n\r\nMake sure ONLY 3 Options Enabled in LazyRaider:\r\n - Run Without a Tank\r\n - Disable Plug-ins\r\n - Frame Lock",
                "Important Note",
                MessageBoxButtons.OK, MessageBoxIcon.Information);
            Logging.Write("----------------------------------");
            Logging.Write("Raid Mode On");
            Logging.Write("----------------------------------");

            if (File.Exists(Utilities.AssemblyDirectory +
                            @"\Routines\TuanHADKSpecialEdition\Preset\TuanHA Death Knight Defaut Raid.xml"))
            {
                Logging.Write("----------------------------------");
                THSettings.Instance.LoadFromXML(XElement.Load(Utilities.AssemblyDirectory +
                                                              @"\Routines\TuanHADKSpecialEdition\Preset\TuanHA Death Knight Defaut Raid.xml"));
                Logging.Write("Load TuanHA Death Knight Defaut Raid Settings from a file complete");
                Logging.Write("----------------------------------");
                THDKForm_Load(null, null);
            }
            else
            {
                Logging.Write("----------------------------------");
                Logging.Write("File not exists: " + Utilities.AssemblyDirectory +
                              @"\Routines\TuanHADKSpecialEdition\Preset\TuanHA Death Knight Defaut Raid.xml");
                Logging.Write("Load TuanHA Death Knight Defaut AFK Raid from a file fail.");
                Logging.Write("----------------------------------");
            }
        }


        private void PvP_Click(object sender, EventArgs e)
        {
            MessageBox.Show(
                Classname.GetCurrentSpec() + " Death Knight " +
                "PvP Mode: Work best with LazyRaider in PvP.",
                //\r\n\r\nMake sure ONLY 3 Options Enabled in LazyRaider:\r\n - Run Without a Tank\r\n - Disable Plug-ins\r\n - Frame Lock",
                "Important Note",
                MessageBoxButtons.OK, MessageBoxIcon.Information);
            Logging.Write("----------------------------------");
            Logging.Write("PvP Mode On");
            Logging.Write("----------------------------------");

            if (File.Exists(Utilities.AssemblyDirectory +
                            @"\Routines\TuanHADKSpecialEdition\Preset\TuanHA Death Knight Defaut PvP.xml"))
            {
                Logging.Write("----------------------------------");
                THSettings.Instance.LoadFromXML(XElement.Load(Utilities.AssemblyDirectory +
                                                              @"\Routines\TuanHADKSpecialEdition\Preset\TuanHA Death Knight Defaut PvP.xml"));
                Logging.Write("Load TuanHA Death Knight Defaut PvP Settings from a file complete");
                Logging.Write("----------------------------------");
                THDKForm_Load(null, null);
            }
            else
            {
                Logging.Write("----------------------------------");
                Logging.Write("File not exists: " + Utilities.AssemblyDirectory +
                              @"\Routines\TuanHADKSpecialEdition\Preset\TuanHA Death Knight Defaut PvP.xml");
                Logging.Write("Load TuanHA Death Knight Defaut AFK PvP from a file fail.");
                Logging.Write("----------------------------------");
            }
        }

        private void Quest_Click(object sender, EventArgs e)
        {
            MessageBox.Show(
                Classname.GetCurrentSpec() + " Death Knight " +
                "Quest Helper Mode: Work best with LazyRaider in solo questing.\r\n\r\nJust select your target, the bot will move to melee range and attack.",
                //\r\n\r\nMake sure ONLY 3 Options Enabled in LazyRaider:\r\n - Run Without a Tank\r\n - Disable Plug-ins\r\n - Frame Lock",
                "Important Note", MessageBoxButtons.OK, MessageBoxIcon.Information);
            Logging.Write("----------------------------------");
            Logging.Write("Quest Helper Mode On");
            Logging.Write("----------------------------------");

            if (File.Exists(Utilities.AssemblyDirectory +
                            @"\Routines\TuanHADKSpecialEdition\Preset\TuanHA Death Knight Defaut Quest.xml"))
            {
                Logging.Write("----------------------------------");
                THSettings.Instance.LoadFromXML(XElement.Load(Utilities.AssemblyDirectory +
                                                              @"\Routines\TuanHADKSpecialEdition\Preset\TuanHA Death Knight Defaut Quest.xml"));
                Logging.Write("Load TuanHA Death Knight Defaut Quest Settings from a file complete");
                Logging.Write("----------------------------------");
                THDKForm_Load(null, null);
            }
            else
            {
                Logging.Write("----------------------------------");
                Logging.Write("File not exists: " + Utilities.AssemblyDirectory +
                              @"\Routines\TuanHADKSpecialEdition\Preset\TuanHA Death Knight Defaut Quest.xml");
                Logging.Write("Load TuanHA Death Knight Defaut AFK Quest from a file fail.");
                Logging.Write("----------------------------------");
            }
        }


        private void AFK_Click(object sender, EventArgs e)
        {
            MessageBox.Show(
                Classname.GetCurrentSpec() + " Death Knight " +
                "Full AFK Mode: Work best with BGBuddy, ArcheologyBuddy, DungeonBuddy, Grind Bot, Questing...",
                "Important Note", MessageBoxButtons.OK, MessageBoxIcon.Information);
            Logging.Write("----------------------------------");
            Logging.Write("Full AFK Mode On");
            Logging.Write("----------------------------------");

            if (File.Exists(Utilities.AssemblyDirectory +
                            @"\Routines\TuanHADKSpecialEdition\Preset\TuanHA Death Knight Defaut AFK.xml"))
            {
                Logging.Write("----------------------------------");
                THSettings.Instance.LoadFromXML(XElement.Load(Utilities.AssemblyDirectory +
                                                              @"\Routines\TuanHADKSpecialEdition\Preset\TuanHA Death Knight Defaut AFK.xml"));
                Logging.Write("Load TuanHA Death Knight Defaut AFK Settings from a file complete");
                Logging.Write("----------------------------------");
                THDKForm_Load(null, null);
            }
            else
            {
                Logging.Write("----------------------------------");
                Logging.Write("File not exists: " + Utilities.AssemblyDirectory +
                              @"\Routines\TuanHADKSpecialEdition\Preset\TuanHA Death Knight Defaut AFK.xml");
                Logging.Write("Load TuanHA Death Knight Defaut AFK Settings from a file fail.");
                Logging.Write("----------------------------------");
            }
        }

        private void SaveSetting_Click(object sender, EventArgs e)
        {
            var saveFileDialog = new SaveFileDialog();
            saveFileDialog.Filter = "Setting File|*.xml";
            saveFileDialog.Title = "Save Setting to a File";
            saveFileDialog.InitialDirectory = Utilities.AssemblyDirectory +
                                              @"\Routines\TuanHADKSpecialEdition\User Settings\";
            saveFileDialog.DefaultExt = "xml";
            saveFileDialog.FileName = "TuanHA Death Knight " + Classname.GetCurrentSpec();

            saveFileDialog.ShowDialog();

            //if (DialogResult != DialogResult.Abort &&
            //    DialogResult != DialogResult.Ignore &&
            //    DialogResult != DialogResult.No &&
            //    DialogResult != DialogResult.None &&
            //    DialogResult != DialogResult.Retry &&
            //    DialogResult != DialogResult.Cancel)
            //{
            //    Logging.Write(DialogResult.ToString());
            //    return;
            //}

            if (saveFileDialog.FileName.Contains(".xml"))
            {
                //Logging.Write(DialogResult.ToString());
                THSettings.Instance.SaveToFile(saveFileDialog.FileName);
                Logging.Write("----------------------------------");
                Logging.Write("Save Setting to: " + saveFileDialog.FileName);
                Logging.Write("----------------------------------");
            }
        }

        private void LoadSetting_Click(object sender, EventArgs e)
        {
            var openFileDialog = new OpenFileDialog
                {
                    Filter = "Setting File|*.xml",
                    Title = "Load Setting from a File",
                    InitialDirectory = Utilities.AssemblyDirectory + @"\Routines\TuanHADKSpecialEdition\User Settings\"
                };
            openFileDialog.ShowDialog();

            //if (DialogResult != DialogResult.OK)
            //{
            //    Logging.Write(DialogResult.ToString());
            //    return;
            //}

            if (openFileDialog.FileName.Contains(".xml"))
            {
                //Logging.Write(DialogResult.ToString());
                THSettings.Instance.LoadFromXML(XElement.Load(openFileDialog.FileName));
                Logging.Write("----------------------------------");
                Logging.Write("Load Setting from: " + openFileDialog.FileName);
                Logging.Write("----------------------------------");
                THDKForm_Load(null, null);
            }
        }

        private void MindFreeze_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.MindFreezeInterruptMs = (int) MindFreezeInterruptMs.Value;
        }


        private void DeathGripInterrupt_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DeathGripInterruptMs = (int) DeathGripInterruptMs.Value;
        }

        private void Strangulate_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.StrangulateInterruptMs = (int) StrangulateInterruptMs.Value;
        }

        private void Trinket1_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 7; i++)
            {
                if (Trinket1.SelectedIndex == i)
                {
                    THSettings.Instance.Trinket1 = i;
                }
            }
        }

        private void Trinket1HP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.Trinket1HP = (int) Trinket1HP.Value;
        }

        private void Trinket2_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 7; i++)
            {
                if (Trinket2.SelectedIndex == i)
                {
                    THSettings.Instance.Trinket2 = i;
                }
            }
        }

        private void Trinket2HP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.Trinket2HP = (int) Trinket2HP.Value;
        }

        private void ProfBuff_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 7; i++)
            {
                if (ProfBuff.SelectedIndex == i)
                {
                    THSettings.Instance.ProfBuff = i;
                }
            }
        }

        private void ProfBuffHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.ProfBuffHP = (int) ProfBuffHP.Value;
        }

        private void BurstKey_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 46; i++)
            {
                if (BurstKey.SelectedIndex == i)
                {
                    THSettings.Instance.BurstKey = i;
                }
            }
        }

        private void BurstHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.BurstHP = (int) BurstHP.Value;
        }

        private void HealthStone_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HealthStoneHP = (int) HealthStoneHP.Value;
        }

        private void DeathStrikePercent_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DeathStrikeHP = (int) DeathStrikeHP.Value;
        }

        private void UnittoStartAoE_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.UnittoStartAoE = (int) UnittoStartAoE.Value;
        }

        private void EmpowerRuneWeapon_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 4; i++)
            {
                if (EmpowerRuneWeapon.SelectedIndex == i)
                {
                    THSettings.Instance.EmpowerRuneWeapon = i;
                }
            }
        }

        private void IceboundFortitude_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.IceboundFortitudeHP = (int) IceboundFortitudeHP.Value;
        }

        private void RuneTap_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.RuneTapHP = (int) RuneTapHP.Value;
        }

        private void VampiricBlood_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.VampiricBloodHP = (int) VampiricBloodHP.Value;
        }


        private void EmpowerRuneWeaponPercent_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.EmpowerRuneWeaponPercent = (int) EmpowerRuneWeaponPercent.Value;
        }

        private void PillarofFrost_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 4; i++)
            {
                if (PillarofFrost.SelectedIndex == i)
                {
                    THSettings.Instance.PillarofFrost = i;
                }
            }
        }

        private void PillarofFrostPercent_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.PillarofFrostPercent = (int) PillarofFrostPercent.Value;
        }


        private void RaiseDead_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 4; i++)
            {
                if (RaiseDead.SelectedIndex == i)
                {
                    THSettings.Instance.RaiseDead = i;
                }
            }
        }

        private void RaiseDeadPercent_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.RaiseDeadPercent = (int) RaiseDeadPercent.Value;
        }

        private void Buff_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AutoBuff = AutoBuff.Checked;
        }

        private void Face_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AutoFace = AutoFace.Checked;
        }

        private void AutoTarget_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AutoTarget = AutoTarget.Checked;
        }

        private void AttackOOC_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AttackOOC = AttackOOC.Checked;
        }

        private void StartEating_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.UseFoodHP = (int) UseFoodHP.Value;
        }

        private void PauseKey_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 40; i++)
            {
                if (PauseKey.SelectedIndex == i)
                {
                    THSettings.Instance.PauseKey = i;
                }
            }
        }

        private void StrafleLeft_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 40; i++)
            {
                if (StrafleLeft.SelectedIndex == i)
                {
                    THSettings.Instance.StrafleLeft = i;
                }
            }
        }

        private void Forward_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 40; i++)
            {
                if (Forward.SelectedIndex == i)
                {
                    THSettings.Instance.Forward = i;
                }
            }
        }

        private void StrafleRight_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 40; i++)
            {
                if (StrafleRight.SelectedIndex == i)
                {
                    THSettings.Instance.StrafleRight = i;
                }
            }
        }

        private void TurnLeft_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 40; i++)
            {
                if (TurnLeft.SelectedIndex == i)
                {
                    THSettings.Instance.TurnLeft = i;
                }
            }
        }

        private void Backward_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 40; i++)
            {
                if (Backward.SelectedIndex == i)
                {
                    THSettings.Instance.Backward = i;
                }
            }
        }

        private void TurnRight_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 40; i++)
            {
                if (TurnRight.SelectedIndex == i)
                {
                    THSettings.Instance.TurnRight = i;
                }
            }
        }

        private void MindFreezeInterrupt_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.MindFreezeInterrupt = MindFreezeInterrupt.Checked;
        }

        private void StrangulateInterrupt_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.StrangulateInterrupt = StrangulateInterrupt.Checked;
        }

        private void DeathGripInterrupt_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DeathGripInterrupt = DeathGripInterrupt.Checked;
        }

        private void AntiMagicShell_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AntiMagicShell = AntiMagicShell.Checked;
        }

        private void DancingRuneWeapon_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DancingRuneWeapon = DancingRuneWeapon.Checked;
        }

        private void DeathStrike_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DeathStrike = DeathStrike.Checked;
        }

        private void IceboundFortitude_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.IceboundFortitude = IceboundFortitude.Checked;
        }

        private void IceboundFortitudeStun_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.IceboundFortitudeStun = IceboundFortitudeStun.Checked;
        }

        private void IceboundFortitudeStunDuration_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.IceboundFortitudeStunDuration = (int) IceboundFortitudeStunDuration.Value;
        }

        private void HealthStone_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HealthStone = HealthStone.Checked;
        }

        private void RuneTap_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.RuneTap = RuneTap.Checked;
        }

        private void VampiricBlood_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.VampiricBlood = VampiricBlood.Checked;
        }

        private void UseFood_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.UseFood = UseFood.Checked;
        }

        private void AutoMove_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AutoMove = AutoMove.Checked;
        }

        private void AutoPathofFrost_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AutoPathofFrost = AutoPathofFrost.Checked;
        }

        private void AutoRaiseAlly_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AutoRaiseAlly = AutoRaiseAlly.Checked;
        }

        private void AutoRacial_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AutoRacial = AutoRacial.Checked;
        }

        private void AutoTaunt_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AutoTaunt = AutoTaunt.Checked;
        }

        private void DancingRuneWeaponHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DancingRuneWeaponHP = (int) DancingRuneWeaponHP.Value;
        }

        private void SoulReaper_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SoulReaper = SoulReaper.Checked;
        }

        private void SoulReaperHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SoulReaperHP = (int) SoulReaperHP.Value;
        }

        private void AntiMagicShellLichborne_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AntiMagicShellLichborne = AntiMagicShellLichborne.Checked;
        }

        private void AntiMagicShellDebuff_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AntiMagicShellDebuff = AntiMagicShellDebuff.Checked;
        }

        private void AntiMagicShellDebuffNumber_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AntiMagicShellDebuffNumber = (int) AntiMagicShellDebuffNumber.Value;
        }

        private void AntiMagicShellCaster_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AntiMagicShellCaster = AntiMagicShellCaster.Checked;
        }

        private void AntiMagicShellCasterNumber_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AntiMagicShellCasterNumber = (int) AntiMagicShellCasterNumber.Value;
        }

        private void DeathGrip_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DeathGrip = DeathGrip.Checked;
        }

        private void DeathGripMinDistance_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DeathGripMinDistance = (int) DeathGripMinDistance.Value;
        }

        private void ChainsofIce_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.ChainsofIce = ChainsofIce.Checked;
        }

        private void ChainsofIceMinDistance_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.ChainsofIceMinDistance = (int) ChainsofIceMinDistance.Value;
        }

        private void AntiMagicZone_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AntiMagicZone = AntiMagicZone.Checked;
        }

        private void AntiMagicZoneHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AntiMagicZoneHP = (int) AntiMagicZoneHP.Value;
        }

        private void AntiMagicZoneDebuff_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AntiMagicZoneDebuff = AntiMagicZoneDebuff.Checked;
        }

        private void AntiMagicZoneDebuffNumber_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AntiMagicZoneDebuffNumber = (int) AntiMagicZoneDebuffNumber.Value;
        }

        private void AntiMagicZoneCaster_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AntiMagicZoneCaster = AntiMagicZoneCaster.Checked;
        }

        private void AntiMagicZoneCasterNumber_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AntiMagicZoneCasterNumber = (int) AntiMagicZoneCasterNumber.Value;
        }

        private void LichborneFear_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.LichborneFear = LichborneFear.Checked;
        }

        private void LichborneFearDuration_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.LichborneFearDuration = (int) LichborneFearDuration.Value;
        }

        private void LichborneHeal_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.LichborneHeal = LichborneHeal.Checked;
        }

        private void LichborneHealHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.LichborneHealHP = (int) LichborneHealHP.Value;
        }

        private void HealAttackC_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HealAttackC = HealAttackC.Checked;
        }

        private void HealAttackCHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HealAttackCHP = (int) HealAttackCHP.Value;
        }

        private void HealAttackD_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HealAttackD = HealAttackD.Checked;
        }

        private void HealAttackDHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HealAttackDHP = (int)HealAttackDHP.Value;
        }

        private void HealAttackS_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HealAttackS = HealAttackS.Checked;
        }

        private void HealAttackSHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HealAttackSHP = (int)HealAttackSHP.Value;
        }

        private void StrangulateLow_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.StrangulateLow = StrangulateLow.Checked;
        }

        private void StrangulateLowHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.StrangulateLowHP = (int) StrangulateLowHP.Value;
        }

        private void DeathandDecaySnare_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DeathandDecaySnare = DeathandDecaySnare.Checked;
        }

        private void ControlUndead_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.ControlUndead = ControlUndead.Checked;
        }

        private void PlagueLeech_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.PlagueLeech = PlagueLeech.Checked;
        }

        private void UnholyBlight_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.UnholyBlight = UnholyBlight.Checked;
        }

        private void DeathsAdvance_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DeathsAdvance = DeathsAdvance.Checked;
        }

        private void RemorselessWinter_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.RemorselessWinter = RemorselessWinter.Checked;
        }

        private void RemorselessWinterHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.RemorselessWinterHP = (int) RemorselessWinterHP.Value;
        }

        private void RemorselessWinterEnemy_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.RemorselessWinterEnemy = RemorselessWinterEnemy.Checked;
        }

        private void RemorselessWinterEnemyNumber_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.RemorselessWinterEnemyNumber = (int) RemorselessWinterEnemyNumber.Value;
        }

        private void RemorselessWinterDeathGrip_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.RemorselessWinterDeathGrip = RemorselessWinterDeathGrip.Checked;
        }

        private void RemorselessWinterBurst_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.RemorselessWinterBurst = RemorselessWinterBurst.Checked;
        }

        private void DesecratedGround_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DesecratedGround = DesecratedGround.Checked;
        }

        private void DesecratedGroundDebuffMinDuration_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DesecratedGroundDebuffMinDuration = (int) DesecratedGroundDebuffMinDuration.Value;
        }

        private void GorefiendsGraspInterrupt_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.GorefiendsGraspInterrupt = GorefiendsGraspInterrupt.Checked;
        }

        private void GorefiendsGraspInterruptMS_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.GorefiendsGraspInterruptMS = (int) GorefiendsGraspInterruptMS.Value;
        }

        private void GorefiendsGraspAggro_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.GorefiendsGraspAggro = GorefiendsGraspAggro.Checked;
        }

        private void GorefiendsGraspAggroMinDist_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.GorefiendsGraspAggroMinDist = (int) GorefiendsGraspAggroMinDist.Value;
        }

        private void GorefiendsGraspKiter_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.GorefiendsGraspKiter = GorefiendsGraspKiter.Checked;
        }

        private void GorefiendsGraspKiterMinDist_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.GorefiendsGraspKiterMinDist = (int) GorefiendsGraspKiterMinDist.Value;
        }

        private void GorefiendsGraspMelee_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.GorefiendsGraspMelee = GorefiendsGraspMelee.Checked;
        }

        private void GorefiendsGraspMeleeHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.GorefiendsGraspMeleeHP = (int) GorefiendsGraspMeleeHP.Value;
        }

        private void GorefiendsGraspAoE_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.GorefiendsGraspAoE = GorefiendsGraspAoE.Checked;
        }

        private void GorefiendsGraspAoENumber_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.GorefiendsGraspAoENumber = (int) GorefiendsGraspAoENumber.Value;
        }

        private void NecroticStrikeStack_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.NecroticStrikeStack = NecroticStrikeStack.Checked;
        }

        private void NecroticStrikeDeathRuneNumber_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.NecroticStrikeDeathRuneNumber = (int)NecroticStrikeDeathRuneNumber.Value;
        }

        private void NecroticStrikeStackBurst_CheckedChanged(object sender, EventArgs e)
        {
            //THSettings.Instance.NecroticStrikeDebuff = NecroticStrikeStackBurst.Checked;
            THSettings.Instance.NecroticStrikeStackBurst = NecroticStrikeStackBurst.Checked;
        }

        private void DeathGripMelee_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DeathGripMelee = DeathGripMelee.Checked;
        }

        private void DeathGripMeleeHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DeathGripMeleeHP = (int) DeathGripMeleeHP.Value;
        }

        private void ChainofIceMelee_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.ChainofIceMelee = ChainofIceMelee.Checked;
        }

        private void ChainofIceMeleeHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.ChainofIceMeleeHP = (int) ChainofIceMeleeHP.Value;
        }

        private void DarkSimulacrumonAuto_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DarkSimulacrumonAuto = DarkSimulacrumonAuto.Checked;
        }

        private void AntiMagicShellHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AntiMagicShellHP = (int) AntiMagicShellHP.Value;
        }

        private void DarkSimulacrumonCast_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DarkSimulacrumonCast = DarkSimulacrumonCast.Checked;
        }

        private void DarkSimulacrumonCooldown_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DarkSimulacrumonCooldown = DarkSimulacrumonCooldown.Checked;
        }

        private void AntiMagicShellEnemy_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AntiMagicShellEnemy = AntiMagicShellEnemy.Checked;
        }

        private void AntiMagicShellEnemyHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AntiMagicShellEnemyHP = (int) AntiMagicShellEnemyHP.Value;
        }

        private void RemorselessWinterEnemyLow_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.RemorselessWinterEnemyLow = RemorselessWinterEnemyLow.Checked;
        }

        private void RemorselessWinterEnemyLowHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.RemorselessWinterEnemyLowHP = (int) RemorselessWinterEnemyLowHP.Value;
        }

        private void BloodPresence_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.BloodPresence = BloodPresence.Checked;
        }

        private void BloodPresenceHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.BloodPresenceHP = (int) BloodPresenceHP.Value;
        }

        private void DarkSimulacrumon_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DarkSimulacrumon = DarkSimulacrumon.Checked;
        }

        private void BloodTap_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.BloodTap = BloodTap.Checked;
        }

        private void BloodChargeStack_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.BloodChargeStack = (int) BloodChargeStack.Value;
        }

        private void AutoAoE_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AutoAoE = AutoAoE.Checked;
        }

        private void AutoPrecence_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AutoPrecence = AutoPrecence.Checked;
        }

        private void GargoyleFrenzy_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 4; i++)
            {
                if (GargoyleFrenzy.SelectedIndex == i)
                {
                    THSettings.Instance.GargoyleFrenzy = i;
                }
            }
        }

        private void GargoyleFrenzyPercent_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.GargoyleFrenzyPercent = (int) GargoyleFrenzyPercent.Value;
        }

        private void Huddle_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.Huddle = Huddle.Checked;
        }

        private void HuddleHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HuddleHP = (int) HuddleHP.Value;
        }

        private void DeathCoilHealPet_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DeathCoilHealPet = DeathCoilHealPet.Checked;
        }

        private void DeathCoilHealPetHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DeathCoilHealPetHP = (int) DeathCoilHealPetHP.Value;
        }

        private void Follow_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.Follow = Follow.Checked;
        }

        private void FollowDistance_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.FollowDistance = (int) FollowDistance.Value;
        }

        private void InterruptAll_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.InterruptAll = InterruptAll.Checked;
        }

        private void InterruptTarget_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.InterruptTarget = InterruptTarget.Checked;
        }

        private void InterruptFocus_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.InterruptFocus = InterruptFocus.Checked;
        }

        private void ChargeInterrupt_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.ChargeInterrupt = ChargeInterrupt.Checked;
        }

        private void ChargeInterruptMS_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.ChargeInterruptMS = (int) ChargeInterruptMS.Value;
        }

        private void ChargeStunEnemy_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.ChargeStunEnemy = ChargeStunEnemy.Checked;
        }

        private void ChargeStunEnemyHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.ChargeStunEnemyHP = (int) ChargeStunEnemyHP.Value;
        }

        private void ChargeStunFriend_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.ChargeStunFriend = ChargeStunFriend.Checked;
        }

        private void ChargeStunFriendHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.ChargeStunFriendHP = (int) ChargeStunFriendHP.Value;
        }

        private void GnawInterrupt_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.GnawInterrupt = GnawInterrupt.Checked;
        }

        private void GnawInterruptMS_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.GnawInterruptMS = (int) GnawInterruptMS.Value;
        }

        private void GnawStunEnemy_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.GnawStunEnemy = GnawStunEnemy.Checked;
        }

        private void GnawStunEnemyHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.GnawStunEnemyHP = (int) GnawStunEnemyHP.Value;
        }

        private void GnawStunFriend_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.GnawStunFriend = GnawStunFriend.Checked;
        }

        private void GnawStunFriendHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.GnawStunFriendHP = (int) GnawStunFriendHP.Value;
        }

        private void AttackASAP_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AttackASAP = AttackASAP.Checked;
        }

        private void LeapRange_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.LeapRange = LeapRange.Checked;
        }

        private void LeapRangeDist_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.LeapRangeDist = (int) LeapRangeDist.Value;
        }

        private void StrangulateInterruptTarget_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.StrangulateInterruptTarget = StrangulateInterruptTarget.Checked;
        }

        private void StrangulateInterruptTargetHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.StrangulateInterruptTargetHP = (int) StrangulateInterruptTargetHP.Value;
        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AsphyxiateHelpFriend = AsphyxiateHelpFriend.Checked;
        }

        private void AsphyxiateHelpFriendHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AsphyxiateHelpFriendHP = (int) AsphyxiateHelpFriendHP.Value;
        }

    }
}